package com.gzhryc.shared_device.cdb.code.dao.db;

import com.gzhryc.common.NumberTools;
import com.gzhryc.jdbc.annotaion.Column;
import com.gzhryc.jdbc.annotaion.Id;
import com.gzhryc.jdbc.annotaion.JoinField;
import com.gzhryc.jdbc.annotaion.Table;

import java.util.Date;

/**
 * 共享充电宝收费模版
 * @version 2023-05-09
 */
@Table(name="cdb_fee_template")
public class CDBFeeTemplate {

    @Id(autoIncrement = 1000)
    @Column(notNull = true, note = "模版ID")
    protected Long id;

    @Column(name = "user_id", notNull = true, note = "用户ID")
    protected Long userId;

    @Column(notNull = true,length = 64, note = "模版标题")
    protected String title;

    @Column(name = "deposit_money", notNull = true, defVal = "0", note = "押金金额，单位：分")
    protected Integer depositMoney;

    @Column(name = "day_max_money", notNull = true, defVal = "0", note = "每天最大支付金额，单位：分")
    protected Integer dayMaxMoney;

    @Column(name = "pay_interval_money", notNull = true, defVal = "0", note = "每小时支付的金额，单位：分")
    protected Integer payIntervalMoney;

    @Column(name = "free_times", notNull = true, defVal = "0", note = "免费时长，单位：分钟")
    protected Integer freeTimes;

    @Column(name = "update_date", autoUpdateTime = true, note = "最后修改时间")
    protected Date updateDate;

    @Column(name = "create_date")
    protected Date createDate;

    @JoinField(name = "name", fromField = "user_id", toTable = "user_info",type="LEFT")
    protected String userName;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public Integer getDepositMoney() {
        return depositMoney;
    }

    public void setDepositMoney(Integer depositMoney) {
        this.depositMoney = depositMoney;
    }

    public Integer getDayMaxMoney() {
        return dayMaxMoney;
    }

    public void setDayMaxMoney(Integer dayMaxMoney) {
        this.dayMaxMoney = dayMaxMoney;
    }

    public Integer getPayIntervalMoney() {
        return payIntervalMoney;
    }

    public void setPayIntervalMoney(Integer payIntervalMoney) {
        this.payIntervalMoney = payIntervalMoney;
    }

    public Integer getFreeTimes() {
        return freeTimes;
    }

    public void setFreeTimes(Integer freeTimes) {
        this.freeTimes = freeTimes;
    }

    public Date getUpdateDate() {
        return updateDate;
    }

    public void setUpdateDate(Date updateDate) {
        this.updateDate = updateDate;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getDepositMoneyStr() {
        return NumberTools.getMoneyStr(this.depositMoney);
    }

    public String getDayMaxMoneyStr() {
        return NumberTools.getMoneyStr(this.dayMaxMoney);
    }

    public String getPayIntervalMoneyStr() {
        return NumberTools.getMoneyStr(this.payIntervalMoney);
    }

    public String getFeeInfo(){
        String msg = "押金" + this.getDepositMoneyStr() + "元，每小时" + this.getPayIntervalMoneyStr()
                + "元，日封顶" + this.getDayMaxMoneyStr() + "元，免费时长：" + freeTimes + "分钟";
        return msg;
    }
}
